package com.shaokel.config.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 少丶客
 * @ClassName WebConfig
 * @Description TODO
 * @Date 2020/6/24 14:04
 * @Vesion 1.0
 */
@Configuration
public class WebConfig implements  WebMvcConfigurer {

    //过滤/admin下的资源
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/admin/**")
                .excludePathPatterns("/admin")
                .excludePathPatterns("/admin/login");

    }
}